<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<th:block th:include="common/include :: header('编辑养修服务')"></th:block>
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-post-add">
			<input type="hidden" name="id" th:value="${serviceItem.id}">
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">服务名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" th:value="${serviceItem.name}" name="name" id="postName" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">服务项原价：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" th:value="${serviceItem.originalPrice}" name="originalPrice" id="postCode" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">服务项折扣价：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" th:value="${serviceItem.discountPrice}" name="discountPrice" id="postSort" required>
				</div>
			</div>
			<!-- ===== 是否套餐：不让修改，不显示不来 ===== -->
<!--			<div class="form-group">-->
<!--				<label class="col-sm-3 control-label is-required">是否套餐：</label>-->
<!--				<div class="col-sm-8">-->
<!--					<div class="radio-box" th:each="dict : ${@dict.getType('si_car_package')}">-->
<!--						<input type="radio" th:id="${dict.id}" name="carPackage" th:value="${dict.value}" th:checked="${dict.isDefault}">-->
<!--						<label th:for="${dict.id}" th:text="${dict.label}"></label>-->
<!--					</div>-->
<!--				</div>-->
<!--			</div>-->

			<div class="form-group">
				<label class="col-sm-3 control-label is-required">服务分类：</label>
				<div class="col-sm-8">
					<select class="form-control" name="serviceCatalog" th:field="${serviceItem.serviceCatalog}" th:with="type=${@dict.getType('si_service_catalog')}">
						<option th:each="dict : ${type}" th:text="${dict.label}" th:value="${dict.value}">所有</option>
					</select>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">          <!-- 两种方式回显 -->                                      <!-- [[${serviceItem.info}]] -->
					<textarea th:text="${serviceItem.info}" id="remark" name="info" class="form-control valid"></textarea>
				</div>
			</div>

		</form>
	</div>
	<th:block th:include="common/include :: footer"></th:block>
	<script type="text/javascript">
		var prefix = ctx + "/business/serviceItem";

		// 前端校验新增数据-------------------------------------------------------
		/*$("#form-post-add").validate({
			onkeyup: false,
			rules:{
				name:{
					remote: {
		                url: prefix + "/checkPostNameUnique",
		                type: "post",
		                dataType: "json",
		                data: {
		                	"name" : function() {
		                        return $.common.trim($("#postName").val());
		                    }
		                },
		                dataFilter: function(data, type) {
		                	return $.validate.unique(data);
		                }
		            }
				},
				code:{
					remote: {
		                url: prefix + "/checkPostCodeUnique",
		                type: "post",
		                dataType: "json",
		                data: {
		                	"code" : function() {
		                        return $.common.trim($("#postCode").val());
		                    }
		                },
		                dataFilter: function(data, type) {
		                	return $.validate.unique(data);
		                }
		            }
				},
				postSort:{
					digits:true
				},
			},
			messages: {
		        // "": {
		        //     remote: "养修服务编码已经存在"
		        // },
		        "name": {
		            remote: "养修服务名称已经存在"
		        }
		    },
		    focusCleanup: true
		});*/
		
		function submitHandler() {
	        if ($.validate.form()) {
				// 保存信息 刷新表格
	        	// 若依的save方法，参数1：提交的地址 参数2：提交带的数据 参数3：回调函数（这里没有传）
	        	$.operate.save(prefix + "/edit", $('#form-post-add').serialize());
	        }
	    }
	</script>
</body>
</html>
